#!/bin/bash

echo "=== 功能修复测试脚本 ==="
echo

echo "1. 测试注册功能（包含手机号）..."
echo "注册用户: testuser123"
curl -X POST http://localhost:8083/register \
  -H "Content-Type: application/json" \
  -d '{"username":"testuser123","password":"password123","phonenumber":"13800138000","nickname":"测试用户"}'
echo
echo

echo "2. 测试重复手机号注册..."
echo "使用相同手机号注册"
curl -X POST http://localhost:8083/register \
  -H "Content-Type: application/json" \
  -d '{"username":"testuser456","password":"password456","phonenumber":"13800138000","nickname":"测试用户2"}'
echo
echo

echo "3. 测试手机号格式验证..."
echo "使用错误格式手机号注册"
curl -X POST http://localhost:8083/register \
  -H "Content-Type: application/json" \
  -d '{"username":"testuser789","password":"password789","phonenumber":"12345","nickname":"测试用户3"}'
echo
echo

echo "=== 测试完成 ==="
echo
echo "请检查以上测试结果："
echo "1. 第一个注册应该成功（code 200）"
echo "2. 第二个注册应该失败（code 409，手机号重复）"
echo "3. 第三个注册应该失败（code 400，手机号格式错误）"
echo 